export const mixin = {
  methods:{
    // 获取滑动scroll-view的高度
    async getScrollViewHeight(header,homeTabs) {
      var commonHeaderHeight = 0,tabsHeight = 0,contextHeight =0
      // 小程序获取dom节点的高度
      if(header) {
        await new Promise((resolve) => {
              uni.createSelectorQuery().select(header).boundingClientRect(  rect => {
                commonHeaderHeight = rect.height
                resolve();
              }).exec()
          });
      }
      if(homeTabs) {
        await new Promise((resolve) => {
            uni.createSelectorQuery().select(homeTabs).boundingClientRect((rect) => {
              tabsHeight = rect.height;
              resolve();
            }).exec();
        });
      }
      uni.getSystemInfo({
        success:res => {
          // windowHeight:可用高度
          // #ifdef MP-WEIXIN
          res.windowHeight = res.windowHeight - 57
          // #endif
          contextHeight = res.windowHeight  - commonHeaderHeight - tabsHeight  + 'px'   
        }
      })
      return contextHeight
    }
  }
}